import http from '@/utils/http'

export const getUserInfo = () => {
  return async (dispatch) => {
    const result = await http.post('/sys/profile')
    const baseInfo = await http.get(`/sys/user/${result.data.data.userId}`)
    const baseResult = {
      ...result.data.data,
      ...baseInfo.data.data,
    }
    dispatch({
      type: 'user/getUserInfo',
      payload: baseResult,
    })
  }
}
